<template>
    <div>
        <h1>首页</h1>
        <h2>欢迎{{name}}</h2>
    </div>
</template>
<script>
export default {
    data() {
        return {
            name: '',
        };
    },
    methods: {
        getLoginUser(){
            const str = localStorage.getItem("m-user");
            const loginUser = JSON.parse(str);
            console.log(loginUser.name)
            this.name = loginUser.name
            

        }
    },created () {
        this.getLoginUser();
    }
}
</script>